package com.demoapps.client.mvp;

import com.demoapps.client.ClientFactory;
import com.demoapps.client.mvp.activity.MainActivity;
import com.demoapps.client.mvp.activity.SettingsActivity;
import com.demoapps.client.mvp.place.MainPlace;
import com.demoapps.client.mvp.place.SettingsPlace;
import com.google.gwt.activity.shared.Activity;
import com.google.gwt.activity.shared.ActivityMapper;
import com.google.gwt.place.shared.Place;

public class TotalizatorActivityMapper implements ActivityMapper {
	private ClientFactory clientFactory;

	public TotalizatorActivityMapper(ClientFactory clientFactory) {
		super();
		this.clientFactory = clientFactory;
	}
	@Override
	public Activity getActivity(Place place) {
		if (place instanceof MainPlace) {
			return new MainActivity(clientFactory);
		} else if (place instanceof SettingsPlace) {
			return new SettingsActivity(clientFactory);
		}
		return null;
	}
}
